<template>
    <tsdd :orderDtail="orderDtail" :riStatus="riStatus" :Ris="Ris"></tsdd>
</template>
<script>
import tsdd from '../../real-components/ChurchOrderDetailOffline'
import { showLoading, hideLoading } from '../../utils/loading.js'
import { orderDetails } from '../../api/wxh/getData'
import { Toast } from '../../utils/toast.js'
export default {
    data() {
        return {
            orderDtail:{},
            Ris:0,//是否全部已取餐状态
            riStatus:0,//是否全部关闭
        }
    },
    components: {
        tsdd: tsdd
    },
    methods: {
        //判断是否全部已取餐2
        async allGetFoodsly(list){
            console.log(list,"///////////////////**123")
            // this.Ris = 0;
            await list && list.forEach(elements => {
                let item = elements.orderGoodsList;
                item.forEach(element =>{
                    if( element.eatingStatus != 2 && element.eatingStatus != 3){
                        this.Ris = 1;
                        return
                        // console.log(this.Ris,"sanfjnaskfnkasnf-2内循环2------")
                        // return this.Ris;
                    }
                })
            });
            // console.log(this.Ris,"sanfjnaskfnkasnf-外循环2------")
            // return this.Ris;
        },
        // 判断是否全部已关闭
        async allGetFoods(list){
            console.log(list,"///////////////////**123129")
            await list && list.forEach(element => {
                if( element.status != 2){
                    this.riStatus = 1;
                    return
                }
               
            });
            console.log(this.riStatus,"this.riStatus-----1111111")
        },  
    },
    async created() {
        const id = this.$route.query.id
        showLoading();
        let res = await orderDetails(id);
        let working = '';
        if(res.returnCode === 0) {
            Toast({
                message: res.msg || '数据加载异常！',
                duration: 1000,
                type: 'fail'
            })
            hideLoading();
            return
        }
        if(res.returnCode === 1) {
            if(!res.data[0]) {
                Toast({
                    message: res.msg || '无数据！',
                    duration: 1000,
                    type: 'success'
                })
                hideLoading();
                return
            }
            hideLoading();
        }
        this.orderDtail = res.data[0]
        // this.allGetFoodsly(res.data[0].paraishOrderGoods);
        this.allGetFoods(res.data[0].childOrderList);

        console.log(this.orderDtail,"3333333333333333333333333333333333/*")

    },
    mounted(){
        document.querySelector(".home-container").style.transform = "none"
    },
    beforeDestroy() {
        document.querySelector(".home-container").style.transform = "translateX(0px)"
    }
    
}
</script>
<style>
/* .home-container{
    transform: none !important;
    display:inline !important;
} */
</style>
